package com.lancoo.ccas52.arrangecourse.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author FortySun
 * @Description 教学班
 * @Date 2023-01-05 16:36
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CourseUnit implements Comparable<CourseUnit>{

    public CourseUnit(CourseUnit cloneable) {
        unitId = cloneable.getUnitId();
        teachingClassId = cloneable.getTeachingClassId();
        teachingClassName = cloneable.getTeachingClassName();
        teachingClassType = cloneable.getTeachingClassType();
        teachingClassSize = cloneable.getTeachingClassSize();
        teacherIds = cloneable.getTeacherIds();
        studentIds = cloneable.getStudentIds();
        classWeeks = cloneable.getClassWeeks();
        roomType = cloneable.getRoomType();
        courseType = cloneable.getCourseType();
        teachingType = cloneable.getTeachingType();
        taskId = cloneable.getTaskId();
        prohibitTimeslotCodes = cloneable.getProhibitTimeslotCodes();
        courseId = cloneable.getCourseId();
        courseName = cloneable.getCourseName();
        campusId = cloneable.getCampusId();
        connectSection = cloneable.getConnectSection();
        subTeachingClassId = cloneable.getSubTeachingClassId();
        phyClassId = cloneable.getPhyClassId();
        groupIdent = cloneable.getGroupIdent();
        collegeId = cloneable.getCollegeId();
    }

    public CourseUnit(TeachingClassUnit cloneable) {
        unitId = cloneable.getTeachingClassUnitId();
        teachingClassId = cloneable.getTeachingClassId();
        teachingClassName = cloneable.getTeachingClassName();
        teachingClassType = cloneable.getTeachingClassType();
        teachingClassSize = cloneable.getTeachingClassSize();
        teacherIds = cloneable.getTeacherIds();
        studentIds = cloneable.getStudentIds();
        classWeeks = cloneable.getClassWeeks();
        roomType = cloneable.getRoomType();
        courseType = cloneable.getCourseType();
        teachingType = cloneable.getTeachingType();
        taskId = cloneable.getTaskId();
        prohibitTimeslotCodes = cloneable.getProhibitTimeslotCodes();
        courseId = cloneable.getCourseId();
        courseName = cloneable.getCourseName();
        campusId = cloneable.getCampusId();
        connectSection = cloneable.getConnectSection();
        subTeachingClassId = cloneable.getSubTeachingClassId();
        phyClassId = cloneable.getPhyClassId();
        groupIdent = cloneable.getGroupIdent();
        collegeId = cloneable.getCollegeId();
    }
    //排课单元id
    //一个排课单元对应课表上的一个课时；
    //即某个教学班的，某种授课方式中的，一个周课时
    private Integer unitId;
    //教学班id
    private Long teachingClassId;
    //教学班名称
    private String teachingClassName;
    /**教学班类型 0:无需选课 1:在线选课 2:分级教学 3:预选教学班*/
    private Integer teachingClassType;
    //教学班人数
    private Integer teachingClassSize;
    //教师id字符串，多个教师以逗号分隔
    private String teacherIds;
    //教学班的所有学生id，没有默认为空,多个用逗号分隔
    private String studentIds;
    //上课周次，二进制表示，一个学期有多少周，就有多少位，有课为1，无课为0
    //如单双周，就是101010...，这种样式
    private String classWeeks;
    //教室类型
    private Integer roomType;
    //课程属性，是环节还是课程，课程1，环节2；
    private Integer courseType;
    //授课类型，讲授1，实验2，上机3，其他4；
    private Integer teachingType;
    //学期排课计划id
    private Integer taskId;
    //禁排的上课课时；
    private String prohibitTimeslotCodes;
    //课程id
    private Long courseId;
    //课程名称
    private String courseName;

    //校区id
    private String campusId;

    //连上节次
    private Integer connectSection;

    //连上分组标识
    private String groupIdent;
    /**子教学班id*/
    private Integer subTeachingClassId;
    //行政班id
    private String phyClassId;
    //院系id
    private String collegeId;


    @Override
    public int compareTo(CourseUnit o) {

        if (o.getTeachingClassSize() < this.getTeachingClassSize()) {
            return 1;
        } else if (o.getTeachingClassSize() > this.getTeachingClassSize()) {
            return -1;
        }

        return 0;
    }
}
